package com.yusheng.service;

import com.yusheng.dao.QueryAppproval;
import com.yusheng.dao.QueryStaff;
import com.yusheng.entity.ApprovalRecord;
import com.yusheng.entity.ApprovalRecordList;

/**
 * MVC的M   （Model Object）业务层逻辑对象，主要用来处理业务
 *
 */
public class ApprovalUpdate {

    public boolean processApproval(String recordNo, String answer, String opionion) {
        boolean success=false;
        if ("no".equals(answer.trim())){

         ApprovalRecord approvalRecord= QueryAppproval.getApprovalsByRecordNo(recordNo).approvalRecordList.get(0);
         if(!QueryAppproval.approvalNot(approvalRecord.getMainRecord(),opionion)){
             return success;
         }else success=true;
        }else{
            if(!QueryAppproval.approvalYes(recordNo,opionion)){
                return success;
            }else success=true;
        }
        return success;
    }
}
